package forms;

import java.sql.SQLException;

import javax.servlet.http.HttpServletRequest;
import javax.sql.RowSet;

import model.AdminModel;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

import db.DbException;



public class ReviewerFormInsert extends ActionForm {
	
	// debug flag
	private static final boolean DEBUG = true;
	
	// =============== Form Variables ============= //
	private String username = null;
	private String password = null;
	
	// =============== Getter and Setters ================ //
	public String getUsername() {
		return username;
	}
	public void setUsername(String uname) {
		username = uname;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String pass) {
		this.password = pass;
	}
	/**
	 * Validate the input data. If validation fails, then report the errors in
	 * students.jsp, and specifically where <html:errors/> is located.
	 * 
	 * @param mapping
	 *            The mapping used to select this instance
	 * @param request
	 *            The servlet request we are processing
	 */
	public ActionErrors validate(ActionMapping mapping,
			HttpServletRequest request) {

		ActionErrors errors = new ActionErrors();
		String path = mapping.getPath();
		
		if (DEBUG) {
			System.err.println("ReviewerFormInsert: "  + path);
		} 
			
			if ((username == null) || (username.length() < 1) )
				errors.add("firstMsgTag1", new ActionMessage("errors.required",
						"username"));
	
			if ((password == null) || (password.length() < 1))
				errors.add("lastMsgTag1", new ActionMessage("errors.required",
						"password"));		
			
		return errors;
	}
}
